<?php require_once('../Connections/agriculture.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_sfmanageRecordset1 = 10;
$pageNum_sfmanageRecordset1 = 0;
if (isset($_GET['pageNum_sfmanageRecordset1'])) {
  $pageNum_sfmanageRecordset1 = $_GET['pageNum_sfmanageRecordset1'];
}
$startRow_sfmanageRecordset1 = $pageNum_sfmanageRecordset1 * $maxRows_sfmanageRecordset1;

mysql_select_db($database_agriculture, $agriculture);
$query_sfmanageRecordset1 = "SELECT * FROM fmanage";
$query_limit_sfmanageRecordset1 = sprintf("%s LIMIT %d, %d", $query_sfmanageRecordset1, $startRow_sfmanageRecordset1, $maxRows_sfmanageRecordset1);
$sfmanageRecordset1 = mysql_query($query_limit_sfmanageRecordset1, $agriculture) or die(mysql_error());
$row_sfmanageRecordset1 = mysql_fetch_assoc($sfmanageRecordset1);

if (isset($_GET['totalRows_sfmanageRecordset1'])) {
  $totalRows_sfmanageRecordset1 = $_GET['totalRows_sfmanageRecordset1'];
} else {
  $all_sfmanageRecordset1 = mysql_query($query_sfmanageRecordset1);
  $totalRows_sfmanageRecordset1 = mysql_num_rows($all_sfmanageRecordset1);
}
$totalPages_sfmanageRecordset1 = ceil($totalRows_sfmanageRecordset1/$maxRows_sfmanageRecordset1)-1;

$queryString_sfmanageRecordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_sfmanageRecordset1") == false && 
        stristr($param, "totalRows_sfmanageRecordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_sfmanageRecordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_sfmanageRecordset1 = sprintf("&totalRows_sfmanageRecordset1=%d%s", $totalRows_sfmanageRecordset1, $queryString_sfmanageRecordset1);
?><div ><a href="stianjian.php">查看信息</a></div>
        <div ><a href="wtianjian.php">录入信息</a></div>
      <div ><a href="drtianjian.php">修改/删除信息</a></div>
      <div ><a href="out.php">退出登陆</a></div>
	  <br>
      <table width="800" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <td>ID</td>
          <td>名称</td>
          <td>症状</td>
          <td>处理时间</td>
          <td>处理方法</td>
        </tr>
        <?php do { ?>
          <tr>
            <td><?php echo $row_sfmanageRecordset1['fmanage_id']; ?></td>
            <td><?php echo $row_sfmanageRecordset1['fmanage_crop']; ?></td>
            <td><?php echo $row_sfmanageRecordset1['fmanage_symptom']; ?></td>
            <td><?php echo $row_sfmanageRecordset1['fmanage_time']; ?></td>
            <td><?php echo $row_sfmanageRecordset1['fmanage_method']; ?></td>
          </tr>
          <?php } while ($row_sfmanageRecordset1 = mysql_fetch_assoc($sfmanageRecordset1)); ?>
      </table>
      <p>
      <table border="0" width="50%">
        <tr>
          <td width="23%" align="center"><?php if ($pageNum_sfmanageRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_sfmanageRecordset1=%d%s", $currentPage, 0, $queryString_sfmanageRecordset1); ?>">第一页</a>
                <?php } // Show if not first page ?>
          </td>
          <td width="31%" align="center"><?php if ($pageNum_sfmanageRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_sfmanageRecordset1=%d%s", $currentPage, max(0, $pageNum_sfmanageRecordset1 - 1), $queryString_sfmanageRecordset1); ?>">上一页</a>
                <?php } // Show if not first page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_sfmanageRecordset1 < $totalPages_sfmanageRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_sfmanageRecordset1=%d%s", $currentPage, min($totalPages_sfmanageRecordset1, $pageNum_sfmanageRecordset1 + 1), $queryString_sfmanageRecordset1); ?>">下一页</a>
                <?php } // Show if not last page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_sfmanageRecordset1 < $totalPages_sfmanageRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_sfmanageRecordset1=%d%s", $currentPage, $totalPages_sfmanageRecordset1, $queryString_sfmanageRecordset1); ?>">最后页</a>
                <?php } // Show if not last page ?>
          </td>
        </tr>
      </table>
      </p>
<div align="center"></div>

      <?php
mysql_free_result($sfmanageRecordset1);
?>
